package com.dlx.mem.client;

import com.dlx.common.result.Result;
import com.dlx.model.mem.MemInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.math.BigDecimal;

/**
 * <h3>smms_parent</h3>
 *
 * @author nglon
 * @description <p>会员信息远程调用类</p>
 * @date 2021-11-16 20:15
 **/
@FeignClient("service-mem")
@Component
public interface MemInfoFeignClient {

    /**
     * 通过id
     *
     * @param id id
     * @return {@link MemInfo}
     */
    @GetMapping("/admin/mem/info/getById/{id}")
    MemInfo getById(@PathVariable("id") Long id);

    /**
     * 通过用户id
     *
     * @param userId 用户id
     * @return {@link MemInfo}
     */
    @GetMapping("/admin/mem/info/getByUserId/{userId}")
    MemInfo getByUserId(@PathVariable("userId") Long userId);

    /**
     * 更新
     *
     * @param memInfo mem信息
     * @return {@link Result}
     */
    @PostMapping("/admin/mem/info/update")
    Result update(@RequestBody MemInfo memInfo);

    /**
     * 更新mem的id信息资产和总充值金额
     *
     * @param id                   id
     * @param memInfoBalance       mem信息余额
     * @param memInfoTotalRecharge mem信息总充值金额
     * @return {@link Result}
     */
    @GetMapping("/admin/mem/info/updateMemInfoBalanceAndTotalRecharge/{id}/{memInfoBalance}/{memInfoTotalRecharge}")
    Result updateMemInfoBalanceAndTotalRechargeById(@PathVariable("id") Long id,@PathVariable("memInfoBalance") BigDecimal memInfoBalance,@PathVariable("memInfoTotalRecharge") BigDecimal memInfoTotalRecharge);

    /**
     * 更新mem信息由用户id
     *
     * @param memInfo mem信息
     * @return {@link Result}
     */
    @PostMapping("/admin/mem/info/updateMemInfoByUserId")
    Result updateMemInfoByUserId(@RequestBody MemInfo memInfo);
}
